package mappers;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.stereotype.Controller;
import situ.autoweter.service.SyCosttypeService;
import situ.autoweter.entity.SyCosttype;
import java.util.*;
/**
 * SyCosttype的路由接口服务
 * 
 * @author 胡文
 *
 */
@Controller
public class SyCosttypeController {

	/** SyCosttypeService服务 */
	@Autowired
	private SyCosttypeService syCosttypeService;
	
	/**
	 * 查询所有SyCosttype数据的方法
	 * @param value
	 * @return
	 */
	@RequestMapping(value = "querySyCosttype", produces = {"application/json;charset=UTF-8"})
	public String find(SyCosttype value,Map map) {
		 List<SyCosttype> list= syCosttypeService.find(value);
         map.put("items",list);
         return "页面名称自己改";
	}
	
	/**
	 * 通过id查询SyCosttype数据的方法
	 * 
	 * @return
	 */
	@RequestMapping(value = "querySyCosttypeById/{id}", produces = {"application/json;charset=UTF-8"})
	public String findOne(@PathVariable(name="id") Object id,Map map) {
        SyCosttype obj=  syCosttypeService.findOne(id);
        map.put("SyCosttype",obj);
        return "页面名称自己改";
	}
	
	/**
	 * 插入SyCosttype属性不为空的数据方法
	 * 
	 * @return
	 */
	@RequestMapping(value = "saveSyCosttype", produces = {"application/json;charset=UTF-8"})
	public String save(SyCosttype value) {
		  syCosttypeService.saveNotNull(value);
        return "redirect:/querySyCosttype";
	}
	
	/**
	 * 更新SyCosttype属性不为空的数据方法
	 * 
	 * @return
	 */
	@RequestMapping(value = "updateSyCosttype", produces = {"application/json;charset=UTF-8"})
	public String update(SyCosttype value) {
		  syCosttypeService.updateNotNullById(value);
          return "redirect:/querySyCosttype";
	}
	
	/**
	 * 通过id删除SyCosttype数据方法
	 * 
	 * @return
	 */
	@RequestMapping(value = "delSyCosttypeById/{id}", produces = {"application/json;charset=UTF-8"})
	public String delete(@PathVariable(name="id") Object id) {
		  syCosttypeService.deleteById(id);
          return "redirect:/querySyCosttype";
	}
}
